package entidades;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;


@Entity
@Table(name="Rubros")
public class Rubro implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id @GeneratedValue(strategy=GenerationType.AUTO)
	@Column(nullable=false,name="ID_RUBRO")
	private int idRubro;
	
	@Column(nullable=false, length=50, name="DESC_RUBRO")
	private String descripcion;
	
	@OneToMany(fetch=FetchType.LAZY) 
	@JoinColumn(name="ID_RUBRO")
	private List<Tarea> tareas;
	
	public Rubro(){
		
	}
	

	public int getIdRubro() {
		return idRubro;
	}

	public String getDescripcion() {
		return descripcion;
	}

	public void setIdRubro(int idRubro) {
		this.idRubro = idRubro;
	}

	public void setDescripcion(String descripcion) {
		this.descripcion = descripcion;
	}

	public List<Tarea> getTareas() {
		return tareas;
	}


	public void setTareas(List<Tarea> tareas) {
		this.tareas = tareas;
	}


	@Override
	public String toString(){
		return descripcion;
	}
}
